<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

use View;


class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
           //全局共享变量
$nav='php186';
View::share('nav',$nav);
    //给指定模板共享变量
    /*View::composer(['layouts.art','art.index'],function($view) {
        $view->with('nav','php186');
    });*/
    //
$abc ='a';
$b='b';
View::composer('*',function($view) use($abc,$b){
            $view->with('abc',$abc)->with('b',$b);
        } );
}

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}
